// import { export_json_to_excel } from './Export2Excel';
const {
  export_json_to_excel
} = require('./Export2Excel');
let local = function (tHeader,filterVal,list,name) {
  require.ensure([], () => {
    const data = formatJson(filterVal, list);
    return export_json_to_excel(tHeader, data, name);
  })
  function formatJson(filterVal, jsonData) {
    return jsonData.map(v => filterVal.map(j => v[j]))
  }
};

export default {
  install(vm){
    vm.prototype.$exportToExcel = local;
  }
}
